package com.yiren.dbaa.module.practice_set.basestation.view.dialog;

import android.app.Activity;
import android.app.AlertDialog;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

import com.yiren.dbaa.R;
import com.yiren.dbaa.currency.model.ScreenModel;
import com.yiren.dbaa.util.GraphicUtil;

/**
 * Describe 基站标定对话框
 *
 * @author WRX
 * @date 2022/12/15
 */
public class CalibrationDialog {

    /**
     * 标定说明对话框
     */
    public static void showCalibrationDialog(Activity activity) {
        AlertDialog dialog = new AlertDialog.Builder(activity).create();
        dialog.show();
        WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
        ScreenModel screen = GraphicUtil.getResolutionInfo(activity);
        params.width = (int) ((screen.getWidth() * 5) / 10);
        params.height = (screen.getHeight() * 8) / 10;
        dialog.getWindow().setAttributes(params);
        Window window = dialog.getWindow();
        window.setContentView(R.layout.dialog_base_calibration);
        ImageView ivCloseDialog = (ImageView) window.findViewById(R.id.iv_close_dialog);
        ivCloseDialog.setOnClickListener(v -> {
            dialog.dismiss();
        });
    }

}
